class DevProject < ActiveRecord::Base
  has_and_belongs_to_many :users
  has_many :tickets, :dependent => :delete_all
  
validates :Docs,
        :presence => {:message => "Du måste ange ett Projekt"},
        :length => {:minimum => 3, :message => "Du måste ange minst tre tecken"}
validates :start,
        :presence => {:message => "Du måste ange ett Projekt"},
        :length => {:minimum => 3, :message => "Du måste ange minst tre tecken"}
validates :stop,
        :presence => {:message => "Du måste ange ett Projekt"},
        :length => {:minimum => 3, :message => "Du måste ange minst tre tecken"}
def self.search(search)
if search
  find(:all, :conditions => ['Docs LIKE ?', "%#{search}%"])
  else
    find(:all)
  end
end


  
end